import 'package:aitao_flutter/common_ui/back_nav.dart';
import 'package:aitao_flutter/res/r.dart';
import 'package:aitao_flutter/style/box_style.dart';
import 'package:aitao_flutter/style/color_style.dart';
import 'package:aitao_flutter/style/edgeInsets_style.dart';
import 'package:aitao_flutter/style/text_style.dart';
import 'package:aitao_flutter/utils/log_utils.dart';
import 'package:flutter/material.dart';

import '../../const/common_const.dart';
import '../../request/api.dart';
import '../../request/requestManager.dart';

class AboutPage extends StatefulWidget {
  const AboutPage({super.key});

  @override
  State<AboutPage> createState() => _AboutPageState();
}

class _AboutPageState extends State<AboutPage> {
  @override
  void initState() {
    super.initState();
    getNewVersionData();
  }

  void getNewVersionData() async {
    var result = await RequestManager().post(API.checkUpdateVersion);
    if (result != null && result['code'] == 0) {
      debugPrint('获取版本信息');
      WJLogUtils.wjLog(result);
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: BackNavigation(
        title: MineStringConst.aboutAppText,
      ),
      body: ListView(
        children: [
          Box.vBox(80),
          Image.asset(
            ImagePath.assetsAppLog,
            width: 70,
            height: 70,
          ),
          Box.vBox10,
          Text(
            CommonStringConst.appName,
            style: Styles.normalText_20,
            textAlign: TextAlign.center,
          ),
          Box.vBox(60),
          Container(
            padding: EdgeInsetsStyle.all(20),
            color: ColorStyle.themeColor,
            child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    '检测更新',
                    style: Styles.whiteText_16,
                  ),
                  GestureDetector(
                    child: const Icon(
                      Icons.arrow_forward_ios_rounded,
                      color: ColorStyle.whiteColor,
                    ),
                    onTap: () {},
                  )
                ]),
          )
        ],
      ),
    );
  }
}
